﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace PitBullBusinessLogic.Configuration
{
    public class SettingManager
    {


        public static string GetSettingValue(string p, string p_2)
        {
            throw new NotImplementedException();
        }

        public static Setting SetParam(string Name, string Value)
        {
            Setting setting = GetSettingByName(Name);
            if (setting != null)
                return SetParam(Name, Value, setting.Description);
            else
                return SetParam(Name, Value, string.Empty);
        }

        public static Setting SetParam(string Name, string Value, string Description)
        {
            Setting setting = GetSettingByName(Name);
            if (setting != null)
            {
                if (setting.Name != Name || setting.Value != Value || setting.Description != Description)
                    setting = UpdateSetting(setting.SettingID, Name, Value, Description);
            }
            else
                setting = AddSetting(Name, Value, Description);

            return setting;
        }

        private static Setting AddSetting(string Name, string Value, string Description)
        {
            //Koppla och lägg till en ny setting.
            throw new NotImplementedException();
        }

        private static Setting UpdateSetting(int settingId, string Name, string Value, string Description)
        {
            //Koppla till databasen och gör en uppdatering.

            return new Setting();
        }

        private static Setting GetSettingByName(string Name)
        {
            throw new NotImplementedException();
        }

        public static bool GetSettingValueBoolean(string p, bool p_2)
        {
            throw new NotImplementedException();
        }

        public static string StoreUrl { get; set; }

        public static string StoreName { get; set; }
    }
}
